# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-jsonpath-rw
pkgname=('python2-jsonpath-rw' 'python-jsonpath-rw')
_pkgname=jsonpath-rw
pkgver=1.4.0
pkgrel=6
pkgdesc='A robust and significantly extended implementation of JSONPath for Python.'
arch=('any')
url='https://pypi.org/project/jsonpath-rw/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('5fcbd832975a32d375fd400ebfb84f083c0e7d8780cc63df730a75cca0224bf32d72cb793fcac63fc3afa9697199d7a569af29961da95494253996cc6e5f63b7')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-jsonpath-rw() {
  depends=('python2' 'python2-ply' 'python2-decorator' 'python2-six')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/jsonpath.py" "$pkgdir/usr/bin/jsonpath2.py"
}

package_python-jsonpath-rw() {
  depends=('python' 'python-ply' 'python-decorator' 'python-six')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

